-
Notifications
You must be signed in to change notification settings - Fork 324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[iip-15] Sharing gas-fee for DApps #3844
Conversation
|
🚨 Fail code review process for file action/protocol/context.go.
|
🚨 Fail code review process for file action/protocol/execution/evm/evm.go.
|
🚨 Fail code review process for file action/protocol/execution/evm/evm_test.go.
|
🚨 Fail code review process for file action/protocol/execution/evm/evmstatedbadapter.go.
|
ChatGPT's review about Potential Bugs or Code Smells
Suggestions for Improvement
|
🚨 Fail code review process for file action/protocol/execution/protocol_test.go.
|
🚨 Fail code review process for file action/protocol/poll/consortium.go.
|
🚨 Fail code review process for file action/protocol/poll/staking_committee.go.
|
🚨 Fail code review process for file action/protocol/rewarding/fund.go.
|
🚨 Fail code review process for file action/protocol/rewarding/protocol_test.go.
|
🚨 Fail code review process for file api/serverV2_integrity_test.go.
|
🚨 Fail code review process for file blockchain/integrity/benchmark_test.go.
|
🚨 Fail code review process for file blockchain/integrity/integrity_test.go.
|
|
||
// DepositGas deposits gas | ||
DepositGas func(context.Context, protocol.StateManager, *big.Int) (*action.TransactionLog, error) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these 2 are not used in here, move to evm.go
where they are used
ChatGPT's review about
Here's an improved version of the code: // Package blockindex provides an indexer for blocks
// that supports Sharing of Gas-fee with DApps (SGD)
package blockindex
import (
"context"
"github.com/iotexproject/iotex-address/address"
"github.com/iotexproject/iotex-core/blockchain/block"
"github.com/iotexproject/iotex-core/blockchain/blockdao"
)
// SGDIndexer is the interface for Sharing of Gas-fee with DApps indexer
type SGDIndexer interface {
blockdao.BlockIndexer
// CheckContract checks if a contract is registered for SGD
CheckContract(contract string) (addr address.Address, height uint64, ok bool)
}
type sgdIndexer struct{}
// NewSGDIndexer creates a new SGDIndexer
func NewSGDIndexer() SGDIndexer {
return &sgdIndexer{}
}
func (sgd *sgdIndexer) Start(_ context.Context) error {
return nil
}
func (sgd *sgdIndexer) Stop(_ context.Context) error {
return nil
}
func (sgd *sgdIndexer) Height() (uint64, error) {
return 0, nil
}
func (sgd *sgdIndexer) PutBlock(_ context.Context, _ *block.Block) error {
return nil
}
func (sgd *sgdIndexer) DeleteTipBlock(_ context.Context, _ *block.Block) error {
return errors.New("cannot remove block from indexer")
}
func (sgd *sgdIndexer) CheckContract(contract string) (addr address.Address, height uint64, ok bool) {
// TODO: implement CheckContract
return
} Improvements made:
|
ChatGPT's review about Code ReviewCode Smells
Bugs
Improvements
import (
"context"
"github.com/iotexproject/iotex-address/address"
"github.com/iotexproject/iotex-core/blockchain/block"
)
func (sgd *dummySgdRegistry) CheckContract(contract string) (address.Address, uint64, error) {
return nil, 0, errors.New("contract not found")
} |
🚨 Fail code review process for file chainservice/builder.go.
|
🚨 Fail code review process for file chainservice/chainservice.go.
|
🚨 Fail code review process for file e2etest/bigint_test.go.
|
🚨 Fail code review process for file gasstation/gasstattion_test.go.
|
🚨 Fail code review process for file state/factory/factory.go.
|
🚨 Fail code review process for file state/factory/statedb.go.
|
|
🚨 Fail code review process for file action/protocol/context.go.
|
🚨 Fail code review process for file state/factory/factory.go.
|
🚨 Fail code review process for file state/factory/statedb.go.
|
🚨 Fail code review process for file action/protocol/execution/evm/evm.go.
|
🚨 Fail code review process for file action/protocol/poll/consortium.go.
|
🚨 Fail code review process for file state/factory/factory.go.
|
🚨 Fail code review process for file state/factory/statedb.go.
|
ChatGPT's review about
Here's an improved version of the code that addresses these issues:
This version defines the group of owners once and references it in each file pattern. It also uses more specific file patterns and defines a template for each pattern to reduce duplication. |
🚨 Fail code review process for file action/protocol/staking/handlers_test.go.
|
ChatGPT's review about Code ReviewPotential Bugs or Code Smells
Suggestions for Improvement
type LiquidStakingIndexer struct{}
func (lsi *LiquidStakingIndexer) CandidateVotes(ownerAddr string) *big.Int {
return big.NewInt(0)
}
The resulting code would look like this: // Package liquidstaking provides an interface for reading liquid staking data.
//
// Copyright (c) 2023 IoTeX Foundation
// This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability
// or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed.
// This source code is governed by Apache License 2.0 that can be found in the LICENSE file.
package liquidstaking
import "math/big"
// LiquidStakingIndexer defines the interface of liquid staking reader.
type LiquidStakingIndexer struct{}
// CandidateVotes returns the number of votes for the given owner address.
func (lsi *LiquidStakingIndexer) CandidateVotes(ownerAddr string) *big.Int {
return big.Zero()
} |
🚨 Fail code review process for file action/protocol/staking/protocol.go.
|
🚨 Fail code review process for file action/protocol/staking/protocol_test.go.
|
🚨 Fail code review process for file action/protocol/staking/staking_statereader.go.
|
ChatGPT's review about
Bugs:
Improvements:
|
🚨 Fail code review process for file action/protocol/staking/vote_reviser_test.go.
|
🚨 Fail code review process for file chainservice/builder.go.
|
ChatGPT's review about Code ReviewPotential Bugs or Code Smells
Suggestions for Improvement
|
ChatGPT's review about Potential Bugs or Code Smells
Suggestions for Improvements
|
ChatGPT's review about
Improvements:
|
🚨 Fail code review process for file chainservice/builder.go.
|
🚨 Fail code review process for file chainservice/chainservice.go.
|
ChatGPT's review about
Improvements:
|
🚨 Fail code review process for file chainservice/builder.go.
|
🚨 Fail code review process for file chainservice/chainservice.go.
|
This reverts commit c8139e1.
This reverts commit c8139e1.
Description
EVM and rewarding protocol changes to support SGD
Next PR: implement the SGD registry
Fixes #(issue)
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Test Configuration:
Checklist: